package com.example.take_out_dish.controller;

import com.example.take_out_admin_api.AdminClient;
import com.example.take_out_dish.common.Result;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:none
 * @Author:yyyyys、
 * @Date:2024/7/7 18:32
 * @Version:1.0
 **/
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {
    @Resource
    private AdminClient adminClient;

    @GetMapping("")
    public Result<Boolean> test(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        boolean result = adminClient.vaildateToken(token);
        log.info("result:{}", result);
        return Result.success(result);
    }
}
